import Vue from 'vue';
import VueRouter from 'vue-router';
import HomeView from '../views/HomeView.vue';
import AddBlog from '../components/AddBlog.vue';
import ShowBlogs from '../components/ShowBlogs.vue';
import SingleBlog from '../components/SingleBlog.vue';
import EditBlog from '../components/EditBlog.vue';
Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    component: ShowBlogs,
  },
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue'),
  // },
  {
    path: '/add',
    component: AddBlog,
  },
  {
    path: '/blog/:id',
    component: SingleBlog,
  },
  {
    path: '/edit/:id',
    component: EditBlog,
  },
];

const router = new VueRouter({
  routes,
  mode: 'history', //去掉地址栏里面的#,http://192.168.96.141:8080/add#/
});

export default router;
